<%-- 
    Document   : raportTmpl
    Created on : Feb 13, 2014, 12:45:45 PM
    Author     : Marek
--%>
<%@page import="entities.users.FormSigner"%>
<%@page import="entities.tools.Form"%>
<%@page import="entities.tools.FilledForm"%>
<%@page import="entities.tools.Answer"%>
<%@page import="util.other.ENUMQuestionTypes"%>
<%@page import="entities.tools.Question"%>
<%@page import="java.util.ArrayList"%>
<%@page contentType="text/html;charset=UTF-8" language="java" %>
<%@page isELIgnored="false" %> 
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <h1>Filled Form raport for form: ${form.name}</h1>
        <table border="1" style="width:100%;font-size:9px;">
            <tr>
                <th>Second name</th>
                <th>First name</th>
                <th>Email</th>
                <th>When</th>
                    <c:forEach items="${form.questions}" var="question">
                    <th>${question.question}</th>                    
                    </c:forEach>
                <th>&nbsp;</th>
            </tr>
            <c:forEach items="${filledForms}" var="filledForm">
                <c:if test="${filledForm.formWasFilled eq true}">
                <tr>
                    <td>${filledForm.formSigner.firstName}</td>
                    <td>${filledForm.formSigner.secondName}</td>
                    <td>${filledForm.formSigner.email}</td>
                    <td><fmt:formatDate value="${filledForm.whenFilled}" pattern="yyyy-MM-dd HH:mm:ss" /></td>
                    
                    <c:forEach items="${filledForm.answers}" var="answer">
                        <td>${fn:replace(fn:replace(answer.value,'¶', ' '),'null ','')}</td>
                    </c:forEach>
                    <td>&nbsp;</td>
                </tr>
                </c:if>
            </c:forEach>
        </table>
    </body>
</html>
